const scpClient = require('scp2');
const ora = require('ora');
const chalk = require('chalk');
// const server = require('./products.js');
const spinner = ora('正在发布到' + (process.env.NODE_ENV === 'production' ? '生产' : '测试') + '服务器...');
spinner.start();
scpClient.scp(
  'itmggcloud/',
  {
    host: "121.37.238.208",
    port: "22",
    username: "root",
    password: "sr201909.",
    path: '/data01/app/itmggcloud'
  },
  function (err) {
    spinner.stop();
    if (err) {
      console.log(chalk.red('发布失败.\n'));
      throw err;
    } else {
      console.log(chalk.green('Success! 成功发布到' + (process.env.NODE_ENV === 'production' ? '生产' : '测试') + '服务器! \n'));
    }
  }
);